package com.dhj.methodsTest;

import com.dhj.streamTest.entity.Author;

import java.util.List;

import static com.dhj.streamTest.entity.AuthorList.getAuthors;

public class Demo5 {

    public static void main(String[] args) {
        List<Author> authors = getAuthors();

        authors.stream().distinct()
                .map(author -> author.getName())
                .map(name -> new StringBuilder(name))
                .map(sb -> sb.append("---DHJ"))
                .forEach(sb -> System.out.println(sb));

        System.out.println("-------------------------");


        authors.stream().distinct()
                .map(Author::getName)
                .map(StringBuilder::new)
                .map(sb -> sb.append("---DHJ"))
                .forEach(System.out::println);

    }

}
